import router from '@/router'

export default function (axios) {
  axios.interceptors.response.use((response) => {
    return response.data
  }, (error) => {
    router.push({
      name: 'errors',
      query: {
        from: 'upload',
        error: 'network-error'
      }
    })
    return Promise.reject(error)
  })
  return axios
}
